package work.comeback.omo.model.movie.display;

import lombok.Data;
import work.comeback.omo.dao.movie.IMovieDetail;
import work.comeback.omo.model.movie.detail.MovieDetailData;
import work.comeback.omo.model.movie.info.MovieVoidData;

@Data
public class MovieCard {
    // 影片图片
    private String image;
    // 最新剧集
    private String episode;
    // 标题
    private String title;
    // 类型
    private String genre;
    // 影片ID
    private int movieId;
    // 影片介绍
    private String blurb;
    // 设定是否不存在影片数据
    private boolean isNull = false;
    // 基础数据
    private final MovieDetailData movieDetailData;

    public MovieCard(MovieDetailData movieDetailData) {
        this.movieDetailData = movieDetailData;
        this.image = "https://obs.gduamoe.com/upload/banner/20241225-1/ebf733d174c89eb101bee031ff6a4668.png?x-image-process=image/quality,q_65/format,webp";
        this.episode = "更新至36集";
        this.title = "清明上河图密码";
        this.genre = "悬疑/古装";
        this.movieId = 70893;
    }

    public MovieCard(MovieVoidData movieData, IMovieDetail movieDetailService) {
        this.movieId = movieData.getVodId();
        this.movieDetailData = movieDetailService.getMovieDetailById(this.movieId);

        if (this.movieDetailData  == null) {
            this.isNull = true;
            return;
        }

        this.genre = this.movieDetailData .getVodTag() == null ? movieData.getTypeName() : this.movieDetailData .getVodTag();
        this.image = this.movieDetailData .getVodPic();
        this.title = this.movieDetailData .getVodName();
        this.blurb = this.movieDetailData .getVodBlurb();
        this.episode = this.movieDetailData .getVodRemarks();
    }
}
